package com.atguigu.day02.source;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;

/**
 * 从集合获取数据流
 */
public class Flink01_Source_Collector {
    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        conf.setInteger("rest.port",20000);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(conf);
        env.setParallelism(2);
       //List<Integer> lists = Arrays.asList(1, 2, 4, 5, 6, 8);

       //DataStreamSource<Integer> fromCollection = env.fromCollection(lists);

        DataStreamSource<Integer> fromElements = env.fromElements(1, 2, 3, 4, 5, 6,9 );
        //fromCollection.print();
        fromElements.print();

        env.execute();

    }
}
